<template>
    <section>
        <!-- 面包屑 -->
        <breadcrumbs></breadcrumbs>
        <!-- 查询条件 -->
        <el-form ref="searchForm" :model="searchForm" label-width="100px" inline class="demo-form-inline" size='small' style="border-bottom: 1px solid #f6f6f6;">
            <!-- <el-form-item label="管理员角色" prop="roleId">
                <el-select v-model="searchForm.roleId" filterable clearable placeholder="请选择" @change="schoolChange">
                    <el-option v-for="item in schoolData" :key="item.schoolId" :label="item.schoolName" :value="item.schoolId">
                    </el-option>
                </el-select>
            </el-form-item> -->
            <el-form-item label="管理员姓名" prop="customerName">
                 <el-input v-model="searchForm.customerName" placeholder="请输入管理员姓名"></el-input>
            </el-form-item>
            <el-form-item label="操作类型" prop="type">
                 <el-select v-model="searchForm.type" placeholder="请选择操作类型">
                    <el-option label="登录" value="1"></el-option>
                    <el-option label="新增" value="2"></el-option>
                     <el-option label="修改" value="3"></el-option>
                    <el-option label="删除" value="4"></el-option>
                     <el-option label="禁用" value="5"></el-option>
                    <el-option label="启用" value="6"></el-option>
                </el-select>
            </el-form-item>
             <el-form-item label="起始时间" prop="beginTime">
                <el-date-picker v-model="searchForm.startTime" type="date" placeholder="选择起始时间" value-format="yyyy-MM-dd">
                </el-date-picker>
            </el-form-item>
            <el-form-item label="截止时间" prop="endTime">
                <el-date-picker v-model="searchForm.endTime" type="date" placeholder="选择结束时间" value-format="yyyy-MM-dd">
                </el-date-picker>
            </el-form-item>
   
            <el-form-item>
                <el-button type="primary" @click="searchForm.current = 1;search()">查询</el-button>
                <el-button @click="handleReset">重置</el-button>
            </el-form-item>
        </el-form>
        <!-- <btns @exec="exec"></btns> -->
    <div class="data-container scroll-table">
      <div>
        <div class="ind-title lh50 f16">操作日志列表</div>
      </div>
      <el-table :data="tableData"
                style="width: 100%"
                row-key="dictId"
                border
                @selection-change="tableSelectionChange">
        <el-table-column type="selection"
                         width="80">
        </el-table-column>
        <el-table-column prop="type"
                         label="操作内容">
        <template slot-scope="scope">
             <div  v-if="scope.row.type=='1'">登录</div>
             <div  v-if="scope.row.type=='2'">新增</div>
             <div  v-if="scope.row.type=='3'">修改</div>
             <div  v-if="scope.row.type=='4'">删除</div>
             <div  v-if="scope.row.type=='5'">禁用</div>
             <div  v-if="scope.row.type=='6'">启用</div>
           
            <!-- <p v-if="scope.row.type == 1">登录</p>
            <p v-if="scope.row.type == 2">新增</p>
            <p v-if="scope.row.type == 3">修改</p>
            <p v-if="scope.row.type == 4">删除</p>
            <p v-if="scope.row.type == 5">禁用</p>
            <p v-if="scope.row.type == 6">启用</p> -->
        </template>
        
        </el-table-column>
        
         <el-table-column prop="nickName"
                         label="操作管理员">
        </el-table-column>
        <el-table-column prop="addtime"
                         label="操作时间">
        </el-table-column>
        
      </el-table>
     <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-sizes="[5, 10, 15, 20]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      >

      </el-pagination>
    </div>
         
    </section>
</template>
<style>
</style>
<script>

import btns from '@/components/btns.vue'
import breadcrumbs from "@/components/breadcrumbs.vue";
export default {

    components: {
        btns,
        breadcrumbs,
    },
    data () {
        return {
            tableData:[],
           
            searchForm: {
               
                roleId: '',
                customerName: '',
                type: '',
                beginTime: '',
                endTime: '',
                        
               
            },
             currentPage: 1,
            pageSize: 10,
            total:0,   
         
        }
    },
    created () {
         this.getList()
    },
   
    methods: {

    search () {
        this.getList(this.searchForm);
    },

    tableSelectionChange(val) {
      this.tableSelection = val;
    },
    handleSizeChange(val) {
    this.pageSize = val;
    this.getList(this.currentPage, val);
    // eslint-disable-next-line no-console
    // console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      this.currentPage = val;
      this.getList(val, this.pageSize);
      // eslint-disable-next-line no-console
      // console.log(`当前页: ${val}`);
    },


    handleReset(){
        this.searchForm = {
            "roleId": '',
            "customerName": '',
            "type": '',
            "beginTime": '',
            "endTime": ''
        }
        this.getList();
    },


        getList () {
            this.$api.agreement.caozuorizhi({
                roleId: this.searchForm.roleId,
                customerName: this.searchForm.customerName,
                type: this.searchForm.type,
                beginTime: this.searchForm.beginTime,
                endTime: this.searchForm.endTime,
                current: this.currentPage,
                size: this.pagesize,
            }).then(d => {
                this.tableData = d.data;
                 this.total = d.totalCount;
                
            }).catch(e => {
                console.log(e);
            })
        },
       
    }
}
</script>
